const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    user_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "用户id",
      field: "user_id"
    },
    system_type: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "default",
      primaryKey: false,
      autoIncrement: false,
      comment: "系统类型（默认 default, 其他按照SYSTEM_TYPE常量类型）",
      field: "system_type"
    },
    title: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "标题",
      field: "title"
    },
    detail: {
      type: DataTypes.CHAR(255),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "详情",
      field: "detail"
    },
    business_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "业务id",
      field: "business_id"
    },
    business_type: {
      type: DataTypes.CHAR(180),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "业务类型，字符串（如：订单、充值、提现、等...）",
      field: "business_type"
    },
    type: {
      type: DataTypes.INTEGER(3).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "消息类型（0普通通知, ...）",
      field: "type"
    },
    is_read: {
      type: DataTypes.INTEGER(3).UNSIGNED,
      allowNull: false,
      defaultValue: "1",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否已读（0否, 1是）",
      field: "is_read"
    },
    is_delete_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否已删除（0否, 大于0删除时间）",
      field: "is_delete_time"
    },
    user_is_delete_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "用户是否已删除（0否, 大于0删除时间）",
      field: "user_is_delete_time"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    }
  };
  const options = {
    tableName: "sxo_message",
    comment: "",
    indexes: [{
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }, {
      name: "system_type",
      unique: false,
      type: "BTREE",
      fields: ["system_type"]
    }]
  };
  const SxoMessageModel = sequelize.define("sxo_message_model", attributes, options);
  return SxoMessageModel;
};